<?php

class Default_Form_Profile extends App_Form
{

	public function init()
	{
		$this->setMethod('post');
		$this->setAttrib('class', 'form-signin form-horizontal');
		$this->setDescription('Profile');

		$email = $this->createElement('email', 'email')
				  ->setRequired()
				  ->setLabel('Email')
				  ->addFilter('StringTrim')
				  ->setAttrib('class', 'input-block-level')
				  ->setDecorators(
				  array(
						'ViewHelper',
						array(array('inner' => 'HtmlTag'), array('tag' => 'div', 'class' => 'controls')),
						array('Label', array('class' => 'control-label')),
						array(array('outer' => 'HtmlTag'), array('tag' => 'div', 'class' => 'control-group')),
						array('Errors', array('class' => 'text-error')),
				  ));
		$this->addElement($email);

		$password = $this->createElement('password', 'password')
				  ->setRequired()
				  ->setLabel('Password')
				  ->setAttrib('class', 'input-block-level')
				  ->setDecorators(
				  array(
						'ViewHelper',
						array(array('inner' => 'HtmlTag'), array('tag' => 'div', 'class' => 'controls')),
						array('Label', array('class' => 'control-label')),
						array(array('outer' => 'HtmlTag'), array('tag' => 'div', 'class' => 'control-group')),
						array('Errors', array('class' => 'text-error')),
				  ));
		$this->addElement($password);

		$submit = $this->createElement('submit', 'save')
				  ->setRequired()
				  ->setLabel('Save')
				  ->setAttrib('class', 'btn btn-large btn-primary')
				  ->setDecorators(
				  array(
						'ViewHelper'
				  ));
		$this->addElement($submit);

		$cancel = $this->createElement('button', 'cancel')
				  ->setRequired()
				  ->setLabel('Cancel')
				  ->setAttrib('class', 'btn btn-large')
				  ->setAttrib('data-href', $this->getView()->url(array(), 'default', true))
				  ->setAttrib('data-click', 'url')
				  ->setDecorators(
				  array(
						'ViewHelper'
				  ));
		$this->addElement($cancel);

		$this->setDecorators(
				  array(
						array('Description', array('tag' => 'h2', 'class' => 'form-signin-heading')),
						array('FormErrors', array('onlyCustomFormErrors' => true,
								  'class' => 'text-error',
								  'markupListEnd' => '',
								  'markupListItemEnd' => '',
								  'markupListItemStart' => '',
								  'markupListStart' => ''
						)),
						'FormElements',
						'Form'
				  )
		);
	}

}

